import axios from '@/libs/axios.js'
import baseUrl from './index'
let jsonHeaders = {'content-type': 'application/json;charset=UTF-8'}

// 设备列表
export const getDeviceData = (params, query) => {
    return axios({
        // url: `${baseUrl}/sdn/device/company/${params.companyId}/available/list`,
        url:`${baseUrl}/resource-manager/device/list`,
        method: 'POST',
        params: query,
        data:params,
        headers: jsonHeaders,
    })
}
// 单位内所有设计师
export const getAllDesigner = () => {
    return axios({
        url: `${baseUrl}/identity/company/designerUsers`,
        method: 'get',
        headers: jsonHeaders,
    })
}
// 单个设备的详情
export const getSingleDeviceInfo = (id) => {
    return axios({
        url: `${baseUrl}/sdn/device/${id}`,
        method: 'get',
        headers: jsonHeaders,
    })
}
// 取消分配
export const cancelDistribution = (id) => {
    return axios({
        // url: `${baseUrl}/sdn/device/unoccupation/${id}`,
        url:`${baseUrl}/resource-manager/device/unOccupation/${id}`,
        method: 'get',
        headers: jsonHeaders,
    })
}
// 单位内所有设计师
export const getAllDesignerUserName = (setParams) => {
    return axios({
        url: `${baseUrl}/identity/company/designerUsers${setParams}`,
        method: 'get',
        headers: jsonHeaders,
    })
}
// 分配设备给设计师
export const DistributionForDesigner = (params) => {
    return axios({
        // url: `${baseUrl}/sdn/device/occupation/${params.deviceId}?userId=${params.userId}`,
        url:`${baseUrl}/resource-manager/device/occupation/${params.id}?userId=${params.userId}`,
        method: 'get',
        headers: jsonHeaders,
    })
}
// 攻防工具列表
export const getAttackData = (params,toolsrch) => {
    return axios({
        url: `${baseUrl}/oad/tool/availableInCpy?companyId=${params.companyId}&page=${params.page}&size=${params.size}`,
        method: 'post',
        data:JSON.stringify(toolsrch),
        headers: jsonHeaders,
    })
}
// 分配攻防工具
export const distriToolDevice = (params) => {
    return axios({
        url: `${baseUrl}/oad/tool/${params.id}/assign`,
        method: 'get',
        params:params.data,
        headers: jsonHeaders,
    })
}
// 取消分配攻防工具
export const cancelDistriToolDevice = (id) => {
    return axios({
        url: `${baseUrl}/oad/tool/${id}/unassign`,
        method: 'get',
        headers: jsonHeaders,
    })
}